#!/bin/bash


echo "This install will copy the scripts for mf-firewall into place"
echo "Ruby 1.8 must be installed for this tool to work."
if [ ! -e /usr/bin/ruby1.8 ]; then
	echo "Ruby1.8 was not found. Please install ruby 1.8 and than reinstall MF"
	exit
fi

echo "Copying files and creating ruby folder"

sudo chmod +x bin/*
sudo cp -p bin/* /bin

sudo chmod +x sbin/*
sudo cp -p sbin/* /sbin/

if [ ! -d /usr/lib/ruby/1.8/MFv4 ]; then
	sudo mkdir /usr/lib/ruby/1.8/MFv4
fi
sudo cp libs/* /usr/lib/ruby/1.8/MFv4

sudo cp -p initd/mf.sh /etc/init.d/
sudo update-rc.d mf.sh defaults

echo -e "Install Completed\n\n"

echo -e "To start mf-firewall you will need to run MFctrl start.\nBe sure you have /jail configured the way you want it.\nThis will reset your interface on the settings in /jail configuration.\n\n"
